<!DOCTYPE html>
<html>
<head>
	<title>二叉树的最大深度</title>
</head>
<body>

<script type="text/javascript">
const root = {
	val: 3,
	left: { 
		val: 9,
		left: { val: 88},
		right: { val: 99,}
	},
	right: {
		val: 20,
		left: { val: 15, left: null, right: null },
		right: { val: 7, left: null, right: null },
	},
};

const maxDepth1 = (root) => {
	if(!root) {
		return 0;
	}

	return Math.max(maxDepth1(root.left), maxDepth1(root.right)) + 1;
};
console.log(maxDepth1(root));

</script>
</body>
</html>